package com.atguigu.dga.governance.assessor.security;

import com.atguigu.dga.constant.DgaConstant;
import com.atguigu.dga.governance.assessor.Assessor;
import com.atguigu.dga.governance.bean.AssessParam;
import com.atguigu.dga.governance.bean.GovernanceAssessDetail;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;

/**
 * ClassName: TableSecurityAssessor
 * Package: com.atguigu.dga.governance.assessor.security
 * Description:
 *
 * @Author:
 * @Create: 2024/3/18 11:23
 * @Version: 1.0
 */
@Component("TABLE_SECURITY")
public class TableSecurityAssessor extends Assessor {
    @Override
    public void checkProblem(AssessParam assessParam, GovernanceAssessDetail governanceAssessDetail) {
        String securityLevel = assessParam.getTableMetaInfo().getTableMetaInfoExtra().getSecurityLevel();
        if(securityLevel == null || DgaConstant.SECURITY_LEVEL_UNSET.equals(securityLevel)) {
            governanceAssessDetail.setAssessScore(BigDecimal.ZERO);
            governanceAssessDetail.setAssessProblem("未设置安全级别");
        }
    }
}
